import React from 'react';
import { useState } from 'react';
import contextData, { state } from '../../store/toduContext';
import Child1 from './Child1';
export default function ConText() {
  const [fatherContext, setFatherContext] = useState(state);
  const updateCount = (count) => {
    setFatherContext(() => {
      return {
        list: [
          {
            title: '拉三等奖反馈习',
            content: 'asdfklajdsf',
          },
        ],
        count: 1 + count,
      };
    });
  };
  return (
    <div>
      <h1>父组件</h1>
      <contextData.Provider value={{ ...fatherContext, updateCount }}>
        <Child1 />
      </contextData.Provider>
    </div>
  );
}
